package lkx.demo.test4;

public class Employee {

    //属性（或成员变量）
    int id;  //编号
    String name; //姓名
    int age; //年龄
    double salary; //薪资

    //定义一个方法，用于显示员工的属性信息
    public void show(){
        System.out.println("id = " + id + ",name = " + name +
                ", age = " + age + ", salary = " + salary);
    }

    public String show1(){

//        方法中可以调用方法
        work();

        return "id = " + id + ",name = " + name +
                ", age = " + age + ", salary = " + salary;
    }

    public void work(){
        System.out.println("work hard");
        //方法内不能定义方法！
//        public void show111(){
//
//        }
    }


    public void printNumber(int targetNumber){ //10
        for(int i = 1;i <= targetNumber;i++){

            if(i == 4){
                return ; //用于结束方法。
                //return后面不能声明执行语句
//                System.out.println("哈啊哈哈哈");
            }

            System.out.println(i);
        }
    }

}
